package org.nstack.header.vm;

import org.nstack.header.cluster.ClusterInventory;
import org.nstack.header.host.HostInventory;
import org.nstack.header.message.APIReply;
import org.nstack.header.rest.RestResponse;

import java.sql.Timestamp;
import java.util.List;

import static org.codehaus.groovy.runtime.InvokerHelper.asList;


@RestResponse(fieldsTo = {"hosts=hostInventories", "clusters=clusterInventories"})
public class APIGetVmStartingCandidateClustersHostsReply extends APIReply {
    private List<HostInventory> hostInventories;
    private List<ClusterInventory> clusterInventories;

    public List<HostInventory> getHostInventories() {
        return hostInventories;
    }

    public void setHostInventories(List<HostInventory> hostInventories) {
        this.hostInventories = hostInventories;
    }

    public List<ClusterInventory> getClusterInventories() {
        return clusterInventories;
    }

    public void setClusterInventories(List<ClusterInventory> clusterInventories) {
        this.clusterInventories = clusterInventories;
    }
 
    public static APIGetVmStartingCandidateClustersHostsReply __example__() {
        APIGetVmStartingCandidateClustersHostsReply reply = new APIGetVmStartingCandidateClustersHostsReply();

        String clusterUuid = uuid();

        HostInventory hi = new HostInventory ();
        hi.setAvailableCpuCapacity(2L);
        hi.setAvailableMemoryCapacity(4L);
        hi.setClusterUuid(clusterUuid);
        hi.setManagementIp("192.168.0.1");
        hi.setName("example");
        hi.setState("Enabled");
        hi.setStatus("Connected");
        hi.setClusterUuid(uuid());
        hi.setZoneUuid(uuid());
        hi.setUuid(uuid());
        hi.setTotalCpuCapacity(4L);
        hi.setTotalMemoryCapacity(4L);
        hi.setHypervisorType("KVM");
        hi.setDescription("example");
        hi.setCreateDate(new Timestamp(System.currentTimeMillis()));
        hi.setLastOpDate(new Timestamp(System.currentTimeMillis()));

        reply.setHostInventories(asList(hi));

        ClusterInventory cl = new ClusterInventory();
        cl.setName("cluster1");
        cl.setUuid(clusterUuid);
        cl.setZoneUuid(uuid());
        cl.setCreateDate(new Timestamp(System.currentTimeMillis()));
        cl.setLastOpDate(new Timestamp(System.currentTimeMillis()));
        cl.setHypervisorType("KVM");

        reply.setClusterInventories(asList(cl));


        return reply;
    }

}
